<?php

/**
 * Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
 * Copyright (c) 2010 Mr. Ynk: http://www.mrynk.nl
 */

/**
 * @author Michel Ypma: michel@mrynk.nl
 */

require_once MYTO_CLI . 'Console/CommandLine.php';
require_once MYTO_CLI . 'Console/CommandLine/Action.php';

class ParseAction extends Console_CommandLine_Action
{
    public function execute($value=false, $params=array())
    {
        $range = explode(',', str_replace(' ', '', $value));
        if (count($range) != 2) {
            throw new Exception(sprintf(
                'Option "%s" must be 2 integers separated by a comma',
                $this->option->name
            ));
        }
        $this->setResult($range);
    }
}
?>